package com.ysqcould.revita.service.impl;


import com.ysqcould.common.utils.DateUtils;
import com.ysqcould.revita.domain.GslSlideShow;
import com.ysqcould.revita.mapper.GslSlideShowMapper;
import com.ysqcould.revita.service.IGslSlideShowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 乡村振兴轮播图Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-06-30
 */
@Service
public class GslSlideShowServiceImpl implements IGslSlideShowService
{
    @Autowired
    private GslSlideShowMapper gslSlideShowMapper;

    /**
     * 查询乡村振兴轮播图
     * 
     * @param id 乡村振兴轮播图主键
     * @return 乡村振兴轮播图
     */
    @Override
    public GslSlideShow selectGslSlideShowById(Long id)
    {
        return gslSlideShowMapper.selectGslSlideShowById(id);
    }

    /**
     * 查询乡村振兴轮播图列表
     * 
     * @param gslSlideShow 乡村振兴轮播图
     * @return 乡村振兴轮播图
     */
    @Override
    public List<GslSlideShow> selectGslSlideShowList(GslSlideShow gslSlideShow)
    {
        return gslSlideShowMapper.selectGslSlideShowList(gslSlideShow);
    }

    /**
     * 新增乡村振兴轮播图
     * 
     * @param gslSlideShow 乡村振兴轮播图
     * @return 结果
     */
    @Override
    public int insertGslSlideShow(GslSlideShow gslSlideShow)
    {
        gslSlideShow.setCreateTime(DateUtils.getNowDate());
        return gslSlideShowMapper.insertGslSlideShow(gslSlideShow);
    }

    /**
     * 修改乡村振兴轮播图
     * 
     * @param gslSlideShow 乡村振兴轮播图
     * @return 结果
     */
    @Override
    public int updateGslSlideShow(GslSlideShow gslSlideShow)
    {
        gslSlideShow.setUpdateTime(DateUtils.getNowDate());
        return gslSlideShowMapper.updateGslSlideShow(gslSlideShow);
    }

    /**
     * 批量删除乡村振兴轮播图
     * 
     * @param ids 需要删除的乡村振兴轮播图主键
     * @return 结果
     */
    @Override
    public int deleteGslSlideShowByIds(Long[] ids)
    {
        return gslSlideShowMapper.deleteGslSlideShowByIds(ids);
    }

    /**
     * 删除乡村振兴轮播图信息
     * 
     * @param id 乡村振兴轮播图主键
     * @return 结果
     */
    @Override
    public int deleteGslSlideShowById(Long id)
    {
        return gslSlideShowMapper.deleteGslSlideShowById(id);
    }

    @Override
    public int updateStatus(GslSlideShow show) {
        GslSlideShow gslSlideShow = gslSlideShowMapper.selectGslSlideShowById(show.getId());
        gslSlideShow.setStatus(show.getStatus());
        return gslSlideShowMapper.updateGslSlideShow(gslSlideShow);
    }
}
